<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php"); //
	include("function/function.php");
	include("_include.user.judge.php");
	$kboy_userid = $_SESSION['kboy_userid'];
	$kboy_user = $_SESSION['kboy_user'];
	$action = chkstr(trim($_REQUEST['action']));
	$user_nickname = chkstr(trim($_REQUEST['user_nickname']));
	$user_sex = chkstr(trim($_REQUEST['user_sex']));
	$user_about = chkstr(trim($_REQUEST['user_about']));
	$user_passcode = chkstr(trim($_REQUEST['user_passcode']));
	$user_realname = chkstr(trim($_REQUEST['user_realname']));
	$user_idcard = chkstr(trim($_REQUEST['user_idcard']));
	$user_tel = chkstr(trim($_REQUEST['user_tel']));
	if($action == "edit"){
		// 验证码验证
		if(strlen($user_passcode)<1){
			echo erro("请正确输入验证码！");
		}
		if(!isNumber($user_passcode)){
			echo erro("请正确输入验证码！");
		}
		if($user_passcode != $_SESSION['verifyCode']){
			echo erro("请正确输入验证码！");
		}
		if(!isNumber($user_sex)){
			echo erro("请选择性别");
		}
		if($user_sex >2){
			echo erro("请选择性别");
		}
		
		// 修改数据
		$mysql = new sqlstr("kboy_order"); 
		$mysql -> set("order_realname",$user_realname);
		$mysql -> set("order_idcard",$user_idcard);
		$mysql -> set("order_phone",$user_tel);
		$news_sql = $mysql -> updateSql("uid=$kboy_userid");
		$news_res = mysql_query($news_sql);
		if(!$news_res){
			echo erro("订单修改失败！");
		}
		$mysql = new sqlstr("kboy_user"); 
		$mysql -> set("user_nickname",$user_nickname);
		$mysql -> set("user_sex",$user_sex,true);
		$mysql -> set("user_about",$user_about);
		$mysql -> set("user_realname",$user_realname);
		$mysql -> set("user_idcard",$user_idcard);
		$mysql -> set("user_tel",$user_tel);
		$news_sql = $mysql -> updateSql("uid=$kboy_userid");
		$news_res = mysql_query($news_sql);
		if($news_res){
			echo ok("操作成功","user_basics.php");
		}else{
			echo erro("服务器内部错误");
		}
	}else{
		echo erro("参数错误");
	}
?>
